<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html" %>
    <script type="text/javascript" src="${ctx}/appjs/transfer/memberRefundApply.js"></script>
</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function (i, origText) {
        return '<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">主页</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>财务管理</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>新增提现</strong>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
            '</li>' +
            '</ol>';
    });

</script>

<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <div class="columns pull-left">
                        <h5 class="font-bold">新增提现</h5>
                    </div>
                    <div class="ibox-tools">
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>

                <div class="ibox-content">
                    <div class="form-group row">
                        <label class="col-sm-3 col-form-label text-right"></label>
                        <div class="col-sm-2">
                            <input class="form-control" id="mobile" name="mobile" placeholder="会员手机号">
                        </div>
                        <div class="col-sm-1">
                            <button class="btn btn-primary" id="selectMemberAndAccountByMobile">查询</button>
                        </div>
                    </div>
                    <form class="form-horizontal m-t" id="frmMemberRefundApply">
                        <input type="hidden" name="memberId" id="memberId">
                        <input type="hidden" name="allAmount" id="allAmount">
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">会员名：</label>
                            <div class="col-sm-2">
                                <input class="form-control" id="nickname" placeholder="会员名" readonly>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">会员手机号：</label>
                            <div class="col-sm-2">
                                <input class="form-control" id="userMobile" placeholder="会员手机号" readonly>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">提现金额：</label>
                            <div class="col-sm-2">
                                <input class="form-control" id="refundAmount" name="refundAmount">
                            </div>
                            <div class="col-sm-1">
                                <button type="button" class="btn btn-primary" onclick="transferOutAllAmount()">全部取出
                                </button>
                            </div>
                            <div class="col-sm-3">
                                <span id="totalAmount"></span>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">提现途径：</label>
                            <div class="col-sm-2">
                                <select class="form-control" id="refundBy" name="refundBy">
                                    <option value="0">微信</option>
                                    <option value="1"
                                            <c:if test="${tenantTransfer.transferType == '1'}">hidden</c:if>  >支付宝
                                    </option>
                                    <option value="2"
                                            <c:if test="${tenantTransfer.transferType == '1'}">hidden</c:if>  >银行卡
                                    </option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">提现账户号码：</label>
                            <div class="col-sm-2">
                                <input class="form-control" name="memberMobile" id="memberMobile">
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">对应真实姓名：</label>
                            <div class="col-sm-2">
                                <input class="form-control" name="memberRealName" id="memberRealName">
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-sm-3 col-form-label text-right">用户充电端：</label>
                            <div class="col-sm-2">
                                公众号：<input type="radio" name="refundSource" value="0" style="margin-right:30px">
                                APP：<input type="radio" name="refundSource" value="1">
                            </div>
                        </div>

                        <div class="form-group row"
                             <c:if test="${tenantTransfer.transferType == '1'}">hidden</c:if> >
                            <label class="col-sm-3 col-form-label text-right">银行名称：</label>
                            <div class="col-sm-3 refundBankCodeDiv">
                                <select class="form-control" id="refundBankCode" name="refundBankCode">
                                    <option value="">选择银行</option>
                                    <option value="1002">工商银行</option>
                                    <option value="1002">工商银行</option>
                                    <option value="4026">佛山农商银行</option>
                                    <option value="1005">农业银行</option>
                                    <option value="1003">建设银行</option>
                                    <option value="1026">中国银行</option>
                                    <option value="1020">交通银行</option>
                                    <option value="1001">招商银行</option>
                                    <option value="1066">邮储银行</option>
                                    <option value="1006">民生银行</option>
                                    <option value="1010">平安银行</option>
                                    <option value="1021">中信银行</option>
                                    <option value="1004">浦发银行</option>
                                    <option value="1009">兴业银行</option>
                                    <option value="1022">光大银行</option>
                                    <option value="1027">广发银行</option>
                                    <option value="1025">华夏银行</option>
                                    <option value="1056">宁波银行</option>
                                    <option value="4836">北京银行</option>
                                    <option value="1024">上海银行</option>
                                    <option value="1054">南京银行</option>
                                    <option value="4755">长子县融汇村镇银行</option>
                                    <option value="4216">长沙银行</option>
                                    <option value="4051">浙江泰隆商业银行</option>
                                    <option value="4753">中原银行</option>
                                    <option value="4761">企业银行（中国）</option>
                                    <option value="4036">顺德农商银行</option>
                                    <option value="4752">衡水银行</option>
                                    <option value="4756">长治银行</option>
                                    <option value="4767">大同银行</option>
                                    <option value="4115">河南省农村信用社</option>
                                    <option value="4150">宁夏黄河农村商业银行</option>
                                    <option value="4156">山西省农村信用社</option>
                                    <option value="4166">安徽省农村信用社</option>
                                    <option value="4157">甘肃省农村信用社</option>
                                    <option value="4153">天津农村商业银行</option>
                                    <option value="4113">广西壮族自治区农村信用社</option>
                                    <option value="4108">陕西省农村信用社</option>
                                    <option value="4076">深圳农村商业银行</option>
                                    <option value="4052">宁波鄞州农村商业银行</option>
                                    <option value="4764">浙江省农村信用社联合社</option>
                                    <option value="4217">江苏省农村信用社联合社</option>
                                    <option value="4072">江苏紫金农村商业银行股份有限公司</option>
                                    <option value="4769">北京中关村银行股份有限公司</option>
                                    <option value="4778">星展银行（中国）有限公司</option>
                                    <option value="4766">枣庄银行股份有限公司</option>
                                    <option value="4758">海口联合农村商业银行股份有限公司</option>
                                    <option value="4763">南洋商业银行（中国）有限公司</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-3 col-sm-offset-8 text-right">
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    $(function () {
        $('#refundBankCode').searchableSelect();
        $(".ibox-content").css("height", $(window).height() - 80)
    })

    function transferOutAllAmount() {
        var val = $("#allAmount").val();
        $("#refundAmount").val(val)
    }

    $('#selectMemberAndAccountByMobile').click(function () {
        $.ajax({
            url: prefix + "/selectMemberAndAccountByMobile",
            type: "GET",
            data: {
                'mobile': $("#mobile").val(),
            },
            success: function (data) {
                if (data.status == 200) {
                    $("#nickname").val(data.data.nickname2),
                        $("#allAmount").val(data.data.account),
                        $("#memberId").val(data.data.memberId),
                        $("#userMobile").val(data.data.mobile),
                        $("#totalAmount").text("可以提现金额" + data.data.account + "元")
                } else {
                    layer.msg(data.message);
                }
            },
            error: function (request) {
                layer.msg("查询失败");
                console.log(request)
            },
        });
    })

    addMemberRefundApply.init();
</script>
</body>
</html>
